<template>
	<view class="after-sale-container">
		<view class="title-icon">
			<view></view>
			<view class="cancel-order-title">
				选择售后类型
			</view>
			<view class="cancel-order-icon" @click="returnPreview">
				<uni-icons type="closeempty"></uni-icons>
			</view>
		</view>
		<view class="after-sale-list">
			<view class="after-sale-item" :class="{ 'active': currentSelectAfterSaleTypeId === item.id }"
				v-for="item in afterSaleList" :key="item.id" @click="selectAfterSaleType(item)">
				{{item.name}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentSelectAfterSaleTypeId: 0,
				afterSaleList: [{
						id: 1,
						name: '退款'
					},
					{
						id: 2,
						name: '退货退款'
					},
					{
						id: 3,
						name: '换货'
					},
					{
						id: 4,
						name: '维修'
					}
				],
			};
		},
		methods: {
			returnPreview() {
				this.$emit('click-sftersale');
			},
			selectAfterSaleType(item) {
				this.currentSelectAfterSaleTypeId = item.id;
			},
		},
	};
</script>

<style lang="scss" scoped>
	.after-sale-container {
		width: 100%;
		height: 70vh;
		overflow-y: scroll;
		background-color: #fff;
		border-radius: 10px 10px 0 0;
		padding-bottom: 200rpx;

		.title-icon {
			height: 100rpx;
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			margin-left: auto;
			margin-right: auto;
			padding-top: 50rpx;
			display: flex;
			justify-content: space-around;
			background-color: #f8f8f8;
			z-index: 1;

			.cancel-order-title {
				font-size: 40rpx;
				letter-spacing: 3rpx;
			}

			.cancel-order-icon {
				width: 50rpx;
				height: 50rpx;
				border-radius: 10rpx;
				box-shadow: 0 0 10px 5px rgba(209, 209, 209, 0.6);
				display: flex;
				align-items: center;
				justify-content: center;
				text-align: center;
				background-color: #f8f8f8;

			}
		}

		.after-sale-list {
			width: 90%;
			margin-left: auto;
			margin-right: auto;
			margin-top: 200rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			align-items: center;

			.after-sale-item {
				padding: 15rpx;
				width: 150rpx;
				height: 50rpx;
				border-radius: 10rpx;
				border: 1px solid #ebebeb;
				letter-spacing: 5rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				margin-bottom: 30rpx;
			}
			
			.active{
				border: 1px solid #66596b;
				background-color: #66596b;
				color: #fff;
			}
			
		}
	}
</style>